package java8;

import java.util.stream.Collectors;
import java.util.stream.Stream;

public class StreamTest1 {
    public static int addUp(Stream<Integer> numbers) {
        Integer integer = numbers.collect(Collectors.summingInt(Integer::intValue));
        return integer;
    }

    public static int addUp2(Stream<Integer> numbers) {
        Integer integer = numbers.mapToInt(Integer::intValue).sum();
        return integer;
    }


    public static void main(String[] args) {
        System.out.println(addUp(Stream.of(1,2,3,4,5)));
    }
}
